﻿using Microsoft.Diagnostics.Tracing;
using Microsoft.Diagnostics.Tracing.Session;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Architecture.Logging.Agent
{
    public class Context
    {
        private const String SESSION_NAME = "ArchitectureResearch";

        private ETWTraceEventSource _source;

        public static Context Current = new Context();

        public TraceEventSession Session
        {
            get
            {
                var session = TraceEventSession.GetActiveSession(SESSION_NAME);
                if (session == null)
                {
                    throw new Exception(String.Format("Session {0} doesn't exist", SESSION_NAME));
                }
                return session;
            }
        }


        public ETWTraceEventSource Source
        {
            get { return _source; }
            set { _source = value; }
        }


    }
}
